<template>
  <a-card>
    <a-form-model :model="formdata" v-bind="layout">
      <a-row>
        <!-- 仓库档案 -->
        <!-- 搜索栏 -->
        <a-col :lg="6" :md="6" :sm="24">
          <a-form-model-item label="仓库编码">
            <a-select
              v-model="formdata.depotNo"
              @change="DepotNameChange"
              showSearch
            >
              <a-select-option
                v-for="item in WarehouseCodeList"
                :key="item.id"
                :value="item.depotNo + '|' + item.depotName"
                >{{ item.depotNo }} {{ item.depotName }}</a-select-option
              >
            </a-select>
          </a-form-model-item>
        </a-col>
        <a-col :lg="6" :md="6" :sm="24">
          <a-form-model-item label="仓库名称">
            <a-input disabled v-model="formdata.depotName"></a-input>
          </a-form-model-item>
        </a-col>
      </a-row>

      <a-row>
        <a-col :lg="6" :md="6" :sm="24" align="right" style="float: right">
          <a-button type="primary" @click="getsearch"> 查询 </a-button>
          <a-button :style="{ marginLeft: '8px' }" @click="handleReset">
            重置
          </a-button>
          <a-button
            :loading="asyncLoad"
            type="primary"
            :style="{ marginLeft: '8px' }"
            @click="SyncData"
          >
            与用友同步
          </a-button>
        </a-col>

        <!-- <a-button
          type="primary"
          @click="showModalXinZeng"
          style="margin-bottom: 10px"
        >
          <a-icon type="plus" />
          添加仓库
        </a-button> -->
        <a-button
          style="margin-bottom: 10px"
          @click="exportToExcel"
          type="primary"
          >导出</a-button
        >

        <!-- 彈窗开始 -->
        <a-modal
          :visible="visibleXinZeng"
          width="50%"
          title="添加新的库存组织"
          okText="确定"
          @cancel="handleCancel2"
          @ok="handleOk2"
        >
          <a-form-model
            ref="ruleForm"
            :rules="rules"
            :model="xinzeng_formdata"
            v-bind="layout"
          >
            <a-row>
              <a-col :md="10" :sm="24">
                <a-form-model-item
                  ref="depotNo"
                  label="仓库编码"
                  prop="depotNo"
                >
                  <a-input v-model="xinzeng_formdata.depotNo"></a-input>
                </a-form-model-item>
              </a-col>

              <a-col :md="10" :sm="24">
                <a-form-model-item
                  ref="depotName"
                  label="仓库名称"
                  prop="depotName"
                >
                  <a-input v-model="xinzeng_formdata.depotName"></a-input>
                </a-form-model-item>
              </a-col>
            </a-row>
            <a-row>
              <a-col :md="10" :sm="24">
                <a-form-model-item
                  ref="depotCapacity"
                  label="仓库容量"
                  prop="depotCapacity"
                >
                  <a-input v-model="xinzeng_formdata.depotCapacity" />
                </a-form-model-item>
              </a-col>
            </a-row>
          </a-form-model>
        </a-modal>
        <!-- 新增弹窗结束 -->
      </a-row>
    </a-form-model>

    <!-- 表格 -->

    <a-table
      size="middle"
      bordered
      :data-source="dataSource"
      :columns="columns"
      :pagination="pagination"
      @change="handleTableChange"
      id="myTable"
      type
    >
      <template slot="序号" slot-scope="text, record">
        <editable-cell
          :text="text"
          @change="onCellChange(record.key, 'xuhao', $event)"
        />
      </template>
      <template slot="caozuo" slot-scope="text, record">
        <!-- 修改按钮与修改页面 -->

        <a type="primary" @click="showModal1(record)"> 修改 </a>

        <!-- 删除提示 -->
        <!-- <a-popconfirm
          v-if="dataSource.length"
          title="是否确认删除?"
          @confirm="onDelete(record.id)"
        >
          <a href="javascript:;">删除</a>
        </a-popconfirm> -->
      </template>
    </a-table>
    <!-- 修改弹窗开始 -->
    <a-modal
      title="修改"
      :visible="visible1"
      width="50%"
      @ok="handleOk1"
      @cancel="handleCancel1"
      cancelText="取消"
      okText="保存"
    >
      <a-form-model
        ref="ruleForm"
        :model="xiugai_formdata"
        :rules="rules"
        v-bind="layout"
      >
        <a-row>
          <a-col :md="10" :sm="24">
            <a-form-model-item ref="depotNo" label="库存组织">
              <a-input
                v-model="xiugai_formdata.pkCalbody_dictText"
                disabled
              ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :md="10" :sm="24">
            <a-form-model-item ref="depotNo" label="公司">
              <a-input
                v-model="xiugai_formdata.pkCorp_dictText"
                disabled
              ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :md="10" :sm="24">
            <a-form-model-item ref="depotNo" label="仓库编码">
              <a-input v-model="xiugai_formdata.depotNo" disabled></a-input>
            </a-form-model-item>
          </a-col>

          <a-col :md="10" :sm="24">
            <a-form-model-item ref="depotName" label="仓库名称">
              <a-input v-model="xiugai_formdata.depotName" disabled></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :md="10" :sm="24">
            <a-form-model-item ref="ownedBranch" label="所属分厂">
              <!-- <a-input v-model="xiugai_formdata.ownedBranch"></a-input> -->

              <a-tree-select
                v-model="xiugai_formdata.ownedBranchTitle"
                show-search
                style="width: 100%"
                :tree-data="depTree"
                allow-clear
                :replace-fields="replaceFields"
                @change="changeTreeNode"
              >
                <a-select-option
                  v-for="deptment in depTree"
                  :key="deptment.pkDeptdoc"
                  :value="deptment.pkDeptdoc"
                >
                  {{ deptment.deptname }}
                </a-select-option>
              </a-tree-select>
            </a-form-model-item>
          </a-col>
          <!-- <a-col :md="10" :sm="24">
            <a-form-model-item
              ref="depotCapacity"
              label="仓库容量"
              prop="depotCapacity"
            >
              <a-input v-model="xiugai_formdata.depotCapacity" />
            </a-form-model-item>
          </a-col> -->
        </a-row>
      </a-form-model>
    </a-modal>
    <!-- 修改弹窗结束 -->
  </a-card>
</template>
 
<script>
import { CommonAjax } from "../../services/modules/common";
const common = new CommonAjax();
import FileSaver from "file-saver";
import XLSX from "xlsx";
import { JiChuXinXiSheZhiHttp } from "../../services/modules/JiChuXinXiGuanLi/KuCunZuZhiDangAn";
const $http = new JiChuXinXiSheZhiHttp();
import { sheet2blob } from "@/utils/export.js";
import axios from "axios";

export default {
  data() {
    return {
      replaceFields: {
        children: "syncDepartmentFilesEntityList",
        title: "deptname",
        value: "deptname",
      },
      Loading: false, //kettle掉用同步仓库档案用
      depTree: [], // 部门列表
      queryParam: {
        //查询参数
        page: 1, //第几页
        size: 10, //每页中显示数据的条数
        hosName: "",
        hosCode: "",
        province: "",
        city: "",
      },
      //===============分页========================
      pagination: {
        total: 0,
        current: 1,
        pageSize: 10, //每页中显示10条数据
        pageSizeOptions: ["10"], //每页中显示的数据
        showTotal: (total) => `共有${total}条数据`, //分页中显示总的数据
        showQuickJumper: true, // 显示快速跳转
      },
      asyncLoad: false,
      //新增弹窗
      visibleXinZeng: false,
      xinzeng_formdata: {
        depotNo: "", //仓库编码
        depotName: "", //仓库名称
        depotCapacity: "", //仓库容量
      },

      visible1: false, //修改弹窗
      xiugai_formdata: {
        pkStordoc: "", //主键
        depotNo: "",
        depotName: "",
        depotCapacity: "",
        userId: "",
        id: "",
        pkCalbody_dictText: "", //库存组织
        pkCorp_dictText: "",
        ownedBranch: "",
        ownedBranchTitle: "",
      },

      formdata: {
        depotNo: "", //仓库编码
        //增加数据
        name: "", //
        age: "",
      },

      WarehouseNameList: [], //仓库名称
      WarehouseCodeList: [], //仓库编码
      // 增加栏的格式
      layout: {
        labelCol: { span: 8 },
        wrapperCol: { span: 15 },
      },
      depotNo_jiaoyan: "",

      // 导出专用
      maxSize: "",

      // 表格数据
      dataSource: [
        {
          key: "1",
          xuhao: "1",
          name: "010101",
          sex_dictText: "七和生物",
          depotCapacity_dictText: "100T",
        },
      ],
      count: 2,
      columns: [
        {
          title: "序号",
          key: 1,
          dataIndex: "xuhao",
          align: "center",
          scopedSlots: { customRender: "xuhao" },
        },
        {
          title: "库存组织",
          key: 2,
          dataIndex: "pkCalbody_dictText",
          align: "center",
        },
        {
          title: "公司",
          key: 3,
          dataIndex: "pkCorp_dictText",
          align: "center",
        },
        //          {
        //   title: "仓库地址",
        //   key: 3,
        //   dataIndex: "storaddr",
        //   align: "center",
        // },
        {
          title: "仓库编码",
          key: 4,
          dataIndex: "storcode",
          align: "center",
        },
        {
          title: "仓库名称",
          key: 5,
          dataIndex: "storname",
          align: "center",
        },
        {
          title: "所属分厂",
          key: 6,
          dataIndex: "ownedBranch_dictText",
          align: "center",
        },
        {
          title: "暂封标志",
          key: 7,
          dataIndex: "sealflag",
          align: "center",
        },

        {
          title: "操作",
          key: 8,
          dataIndex: "caozuo",
          scopedSlots: { customRender: "caozuo" },
          align: "center",
        },
      ],
      // 新增验证规则
      rules: {
        depotNo: [
          { required: true, message: "仓库编码为必填项!", trigger: "blur" },
        ],
        depotName: [
          { required: true, message: "仓库名称为必填项！", trigger: "blur" },
        ],
        depotCapacity: [
          { required: true, message: "仓库容量为必填项！", trigger: "blur" },
        ],
      },
    };
  },
  mounted() {
    this.GetInventoryOrganizationFile(); //库存组织档案-列表
    this.getAllNumberName(); //获取仓库编码字典表
    this.getkucunzuzhi(); //调用库存组织查询
    this.getDeparmentTree();
  },

  methods: {
    // 获取部门列表
    getDeparmentTree() {
      console.log("获取部门列表hanshu===");
      common.getUFIDAFactoryName().then((res) => {
        console.log("部门：", JSON.stringify(res));
        if (res.success) {
          this.depTree = res.result.records;
        }
      });
    },
    changeTreeNode(value, label, extra) {
      console.log(value, label);
      this.xiugai_formdata.ownedBranchTitle = value;
      this.xiugai_formdata.ownedBranch =
        extra.triggerNode.$options.propsData.dataRef.pkDeptdoc;
    },
    //搜索开始
    getsearch() {
      let dd = (this.pagination.page = 1); //分页
      (this.dataSource = []), (this.pagination.current = 1);
      $http
        .GetInventoryOrganizationFile(
          "?pageNo=" + dd + "&storcode=" + this.formdata.depotNo
        )
        .then((res) => {
          const pagination = { ...this.pagination }; //分页
          this.data = res.result.records;
          pagination.total = res.result.total; //分页
          pagination.pageSize = res.result.size; //分页
          this.pagination = pagination; //分页
          this.dataSource = res.result.records;
          for (let i = 0; i < res.result.records.length; i++) {
            this.dataSource[i].xuhao = (res.result.current - 1) * 10 + i + 1; //序号
          }
        });
    },
    // 获取库存组织档案列表
    GetInventoryOrganizationFile() {
      let dd = this.queryParam.page; //分页
      (this.dataSource = []),
        $http.GetInventoryOrganizationFile("?pageNo=" + dd).then((res) => {
          const pagination = { ...this.pagination }; //分页
          this.data = res.result.records;
          pagination.total = res.result.total; //分页
          pagination.pageSize = res.result.size; //分页
          this.pagination = pagination; //分页
          this.maxSize = res.result.total;
          this.dataSource = res.result.records;
          for (let i = 0; i < res.result.records.length; i++) {
            this.dataSource[i].xuhao = (res.result.current - 1) * 10 + i + 1; //序号
            this.dataSource[i].key = res.result.records[i].pkStordoc;
          }

          console.log(this.dataSource, "dataSource");
        });
    },

    handleCancel1() {
      // 修改弹窗取消
      this.visible1 = false;
    },

    async handleReset() {
      await this.ResetTab(); //重置分页
      //重置
      this.formdata = {
        depotNo: "",
        depotName: "",
      };
      this.GetInventoryOrganizationFile();
    },
    ResetTab() {
      this.pagination = {
        total: 0,
        current: 1,
        pageSize: 10, //每页中显示10条数据

        showTotal: (total) => `共有${total}条数据`, //分页中显示总的数据
        showSizeChanger: true, // 显示页面条数改变
        showQuickJumper: true, // 显示快速跳转
      };
      //查询参数
      this.queryParam = {
        page: 1, //第几页
        size: 10, //每页中显示数据的条数
        hosName: "",
        hosCode: "",
        province: "",
        city: "",
      };
    },

    //新增弹窗
    showModalXinZeng() {
      this.visibleXinZeng = true;
    },
    handleCancel2() {
      //新增弹窗
      this.visibleXinZeng = !this.visibleXinZeng;
    },
    showModal1(record) {
      this.depotNo_jiaoyan = record.depotNo;
      console.log(record, "record");
      //修改按钮
      this.visible1 = !this.visible1;
      this.xiugai_formdata.depotNo = record.storcode; //仓库编码
      this.xiugai_formdata.ownedBranchTitle = record.ownedBranch_dictText; //所属分厂
      this.xiugai_formdata.ownedBranch = record.ownedBranch; //所属分厂
      this.xiugai_formdata.pkCorp_dictText = record.pkCorp_dictText; //公司

      this.xiugai_formdata.depotName = record.storname; //仓库名称
      this.xiugai_formdata.depotCapacity = record.depotCapacity; //仓库容量
      this.xiugai_formdata.pkCalbody_dictText = record.pkCalbody_dictText; //库存组织
      this.id = record.id;
      this.xiugai_formdata.pkStordoc = record.pkStordoc;
      this.userId = record.userId;
    },
    handleOk1() {
      // 修改弹窗ok
      $http
        .updateownedBranch(
          "?ownedBranch=" +
            this.xiugai_formdata.ownedBranch +
            "&pkStordoc=" +
            this.xiugai_formdata.pkStordoc
        )
        .then((res) => {
          if (res.success) {
            this.$message.success("保存成功！");
            this.GetInventoryOrganizationFile();
            this.visible1 = false;
          } else {
            this.$message.success("保存失败！");
          }
        });

      // this.$refs.ruleForm.validate((valid) => {
      //   if (valid) {
      //     this.visible1 = false;
      //     const data = {
      //       ownedBranch: this.xiugai_formdata.ownedBranch,
      //       id: this.id,
      //     };
      //     console.log("data::::::::::", data);
      //     if (this.depotNo_jiaoyan == this.xiugai_formdata.depotNo) {
      //       $http.updateInventoryOrganization(data).then((res) => {
      //         console.log("我进来了");
      //         if (res.success) {
      //           this.$message.success("保存成功！");
      //           this.GetInventoryOrganizationFile();
      //           console.log(res);
      //         } else {
      //           this.$message.success("保存失败！");
      //         }
      //       });
      //     } else {
      //       //重复检验
      //       $http
      //         .duplicateCheck(
      //           "?fieldName=" +
      //             "depot_no" +
      //             "&tableName=" +
      //             "warehouse_inventory_organization_file" +
      //             "&fieldVal=" +
      //             this.xiugai_formdata.depotNo
      //         )
      //         .then((res) => {
      //           //如果校验成功就发送数据
      //           if (res.success) {
      //             $http.updateInventoryOrganization(data).then((res) => {
      //               console.log("我进来了");
      //               if (res.success) {
      //                 this.$message.success("保存成功！");
      //                 this.GetInventoryOrganizationFile();
      //                 console.log(res);
      //               } else {
      //                 this.$message.success("保存失败！");
      //               }
      //             });
      //           } else {
      //             this.$message.error("仓库编码重复！");
      //           }
      //         });
      //     }
      //   } else {
      //     console.log("false出现了");
      //   }
      // });
    },
    handleOk2() {
      let querPath =
        "?fieldName=" +
        "depot_no" +
        "&tableName=" +
        "warehouse_inventory_organization_file" +
        "&fieldVal=" +
        this.xinzeng_formdata.depotNo;
      //点击增加按钮
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          this.visibleXinZeng = false;
          const data = {
            depotNo: this.xinzeng_formdata.depotNo, //仓库编码
            depotName: this.xinzeng_formdata.depotName, //仓库名称
            depotCapacity: this.xinzeng_formdata.depotCapacity, //仓库容量
          };
          //重复检验
          $http.duplicateCheck(querPath).then((res) => {
            //如果校验成功就发送数据
            if (res.success) {
              $http.InventoryOrganizationFile(data).then((res) => {
                console.log("我进来了");
                if (res.success) {
                  this.$message.success("保存成功！");
                  this.GetInventoryOrganizationFile();
                  console.log(res);
                } else {
                  this.$message.success("保存失败！");
                }
              });
            } else {
              this.$message.error("仓库编码重复！");
            }
          });
          //库存组织新增

          //   axios({
          //   headers: {
          //     "Access-Control-Allow-Origin": "*",
          //     "Content-Type": "application/json",
          //     usercode: "13355262265",
          //     password: "5ef208ee90e5504a7b569ebbd6342634",
          //     system: "test",
          //   },
          //   method: "post",
          //   url: "/proxy/u8cloud/api/uapbd/calbody/insert",
          //   data: {
          //     billvo: [
          //       {
          //         bodycode: this.xinzeng_formdata.depotNo, //仓库编码
          //         bodyname: this.xinzeng_formdata.depotName, //	库存组织名称
          //         pk_areacl: "01", //地区分类
          //         pk_corp: "5001", //	公司主键
          //         property: "0", //	性质
          //       },
          //     ],
          //   },
          // }).then(function (response) {
          //   console.log(response);
          // });

          //↘↘↘↘↘↘↘↘↘↘↘↘↘↘↘↘↘↘↘注释↙↙↙↙↙↙↙↙↙↙↙↙↙↙↙↙
          //1、调用仓库档案新增
          //2、调用仓库档案新增之前需要 先在库存组织新增里面新增库存编码
          //3、目前库存组织版本高、无法新增
          //↗↗↗↗↗↗↗↗↗↗↗↗↗↗↗↗↗↗↗↗↖↖↖↖↖↖↖↖↖↖↖↖↖↖↖↖↖↖
          axios({
            headers: {
              "Access-Control-Allow-Origin": "*",
              // trantype: "code",
              "Content-Type": "application/json",
              usercode: "13355262265",
              password: "5ef208ee90e5504a7b569ebbd6342634",
              system: "test",
            },
            method: "post",
            url: "/proxy/u8cloud/api/uapbd/stordoc/insert",
            data: {
              stordoc: [
                {
                  // pk_corp: "0000",//公司主键
                  // bodyname: this.xinzeng_formdata.depotName, //库存组织名称
                  // bodycode: this.xinzeng_formdata.depotNo, //库存组织编号
                  // pk_areacl: "01",//地区分类
                  // property: "0",//性质
                  storcode: this.xinzeng_formdata.depotNo, //仓库编码
                  storname: this.xinzeng_formdata.depotName, //	仓库名称
                  pk_corp: "1001", //公司
                  pk_calbody: this.xinzeng_formdata.depotNo, //	库存组织编码
                },
              ],
            },
          }).then(function (response) {
            console.log(response);
          });
        } else {
          console.log("false出现了");
        }
      });
    },

    getkucunzuzhi() {
      // 调用库存组织查询
      axios({
        headers: {
          "Access-Control-Allow-Origin": "*",
          "Content-Type": "application/json",
          usercode: "13355262265",
          password: "5ef208ee90e5504a7b569ebbd6342634",
          system: "test",
        },
        method: "post",
        url: "/proxy/u8cloud/api/uapbd/calbody/query",
        data: {},
      }).then(function (response) {
        console.log("库存组织", response);
      });

      //地区列表
      axios({
        headers: {
          "Access-Control-Allow-Origin": "*",
          "Content-Type": "application/json",
          usercode: "13355262265",
          password: "5ef208ee90e5504a7b569ebbd6342634",
          system: "test",
        },
        method: "post",
        url: "/proxy/u8cloud/api/uapbd/bdareacl/query",
        data: {},
      }).then(function (response) {
        console.log("地区", response);
      });
    },

    // ==============分页======================
    handleTableChange(pagination) {
      this.pagination.current = pagination.current;
      this.pagination.pageSize = pagination.pageSize;
      this.queryParam.page = pagination.current;
      this.queryParam.size = pagination.pageSize;
      this.GetInventoryOrganizationFile();
    },

    // 确定删除吗？的触发函数
    onDelete(_id) {
      // console.log(_id, "_id");
      const deletePath = `?id=${_id}`;
      $http
        .deleteInventoryOrganization(deletePath)
        .then((res) => {
          if (res && res.code === 200) {
            this.$message.success("删除成功");
            this.GetInventoryOrganizationFile();
          } else {
            this.$message.error("删除失败");
          }
        })
        .then(() => {
          this.data = [];
        });
    },

    //返回所有的仓库编码、仓库名称
    getAllNumberName() {
      $http.getAllNumberName().then((res) => {
        for (let i = 0; i < res.result.length; i++) {
          let data = {
            depotNo: res.result[i].storcode,
            depotName: res.result[i].storname,
            id: res.result[i].pkStordoc,
          };
          this.WarehouseCodeList.push(data);
          // console.log("返回所有的仓库编码、仓库名称", this.WarehouseCodeList);
        }
      });
    },

    // 选择仓库编码的change触发函数
    DepotNameChange(value, option) {
      this.formdata.id = option.key;
      // console.log(value , option);
      const newValue = value.split("|");
      console.log(newValue);
      this.formdata.depotNo = newValue[0];
      this.formdata.depotName = newValue[1];
    },

    //↘--------↓↓↓---↓↓--↓----------导出--------↓-↓↓---↓↓↓----------↙
    // exportToExcel() {
    //   let et = XLSX.utils.table_to_book(document.querySelector("#myTable")); //此处传入table的DOM节点
    //   console.log(11, et);
    //   let etout = XLSX.write(et, {
    //     bookType: "xlsx",
    //     bookSST: true,
    //     type: "array",
    //   });
    //   try {
    //     FileSaver.saveAs(
    //       new Blob([etout], {
    //         type: "application/octet-stream",
    //       }),
    //       "库存组织档案.xlsx"
    //     ); //trade-publish.xlsx 为导出的文件名
    //   } catch (e) {
    //     console.log(e, etout);
    //   }
    //   return etout;
    // },
    //↗↑↑↑↑----↑↑↑↑----↑↑↑↑----↑↑↑↑-----↑↑↑↑----↑↑↑↑----↑↑↑↑----↑↑↑↑↖

    exportToExcel() {
      $http
        .GetInventoryOrganizationFile(
          "?pageNo=1&pageSize=" +
            this.maxSize +
            "&depotNo=" +
            this.formdata.depotNo
        )
        .then((res) => {
          console.log("导入的数据", res.result.records);
          let array = res.result.records;
          this.exportBasic(array);
        });
    },

    // 接收数组，进行导出
    exportBasic(Array) {
      console.log("要导出的数据为:::::", Array);
      // 规整要导出的数据:::::
      let array = [];
      for (let i = 0; i < Array.length; i++) {
        let data = {
          序号: i + 1,
          库存组织: Array[i].pkCalbody_dictText,
          公司: Array[i].pkCorp_dictText,
          仓库编码: Array[i].storcode,
          仓库名称: Array[i].storname,
        };
        array.push(data);
      }
      // 生成 sheet 表格 数据
      let sheet = XLSX.utils.json_to_sheet(array, {
        // 对导出内容进行相应的排序,手动排序。
        header: ["序号", "库存组织", "公司", "仓库编码", "仓库名称"],
      });
      // 生成导出表格
      let blob = sheet2blob(sheet);
      try {
        FileSaver.saveAs(
          new Blob([blob], {
            type: "application/octet-stream",
          }),
          "仓库档案.xlsx" // 导出文件夹名称
        );
      } catch (e) {
        console.log(e);
      }
    },
    //同步用友数据
    /*   SyncData() {
      this.asyncLoad = true; //

      common.asyncWarehouseArchives().then((res) => {
        console.log("同步用友的数据", res);
        if (res.code == 200) {
          this.$message.success("同步成功");
        } else {
          this.$message.error("同步失败");
        }
        this.asyncLoad = false;
      });
      this.GetInventoryOrganizationFile();
    }, */
    SyncData() {
      this.Loading = true;
      let data = "?transFileName=" + "SyncWarehouseArchives.ktr";
      common.asyncWarehouseArchives(data).then((res) => {
        console.log("res", res);
        if (res.success) {
          this.$message.success("同步成功！");
          this.GetInventoryOrganizationFile();
          this.Loading = false;
        } else {
          this.$message.error("同步失败！" + res.message);
          this.Loading = false;
        }
      });
    },
  },
};
</script>